import request from '@/utils/request'

// 登录方法
export function login(username, password, code, uuid) {
  const data = {
    username,
    password,
    code,
    uuid
  }
  return request({
    'url': '/login',
    headers: {
      isToken: false
    },
    'method': 'post',
    'data': data
  })
}

// 注册方法
export function register(data) {
  return request({
    url: '/register',
    headers: {
      isToken: false
    },
    method: 'post',
    data: data
  })
}

// 获取用户详细信息
export function getInfo() {
  return request({
    'url': '/getInfo',
    'method': 'get'
  })
}

// 退出方法
export function logout() {
  return request({
    'url': '/logout',
    'method': 'post'
  })
}

// 获取验证码
export function getCodeImg() {
  return request({
    'url': '/captchaImage',
    headers: {
      isToken: false
    },
    method: 'get',
    timeout: 20000
  })
}

// 获取路由权限
export function getRouters() {
  return request({
    'url': '/getRouters',
    'method': 'get'
  })
}

// 获取银行卡列表
export function getCardList() {
  return request({
    url: '/member/auth/getCardList',
    method: 'post'
  })
}

// 预定绑卡
export function readySign({ cardInfo, cardType, userId }) {
  return request({
    url: '/app-api/door/baofu/readySign',
    method: 'post',
    data: { cardInfo, cardType, userId }
  })
}

// 确定绑卡
export function confirmSign(uniqueCode, smsCode) {
  return request({
    url: '/app-api/door/baofu/confirmSign',
    method: 'get',
    params: { uniqueCode, smsCode }
  })
}

// 添加银行卡
export function addCard(data) {
  return request({
    url: '/member/auth/addCard',
    method: 'post',
    data
  })
}

// 添加订单信息
export function addOrderInfo(data) {
  return request({
    url: '/app-api/door/order-info/add',
    method: 'post',
    data
  })
}

// 提交订单信息
export function submitOrderInfo(data) {
  return request({
    url: '/app-api/door/order-info/submit',
    method: 'post',
    data
  })
}

// 查询订单列表
export function getOrderList(params) {
  return request({
    url: '/app-api/door/order-info/list',
    method: 'get',
    params
  })
}

// 获取部门价格信息
export function getDeptPrice(deptId) {
  return request({
    url: `/admin-api/door/dept/price/${deptId}`,
    method: 'get'
  });
}

// 获取部门树
export function getDeptTree() {
  return request({
    url: '/system/user/deptTreeNoDataScope',
    method: 'get'
  });
}

// 获取房东列表
export function getLandlordList(params) {
  return request({
    url: '/system/role/authUser/allocatedListNoDataScope',
    method: 'get',
    params
  });
}

// 获取房产地址列表
export function getHouseList(params) {
  return request({
    url: '/door/house/list',
    method: 'get',
    params
  });
}

// 银行卡支付接口
export function singlePay(params) {
  return request({
    url: '/app-api/door/baofu/singlePay',
    method: 'get',
    params
  });
}

// 查询门禁明细列表
export function getDoorDetailList(params) {
  return request({
    url: '/admin-api/door/detail/list',
    method: 'get',
    params
  });
}

// 查询订单详情
export function getOrderDetailInfo(id) {
  return request({
    url: `/door/info/${id}`,
    method: 'get'
  });
}

// 获取微信openid
export function getMpOpenId(code) {
  return request({
    url: '/member/auth/mpOpenId',
    method: 'get',
    params: { code }
  });
}

// 查询订单状态
export function getOrderStatus(orderId) {
  return request({
    url: `/app-api/door/order-info/${orderId}`,
    method: 'get'
  })
}

// 解绑银行卡
export function unSignCard(data) {
  return request({
    url: '/app-api/door/baofu/unSign',
    method: 'post',
    data: data
  })
}

// 发送服务号订阅消息
export function sendServiceMessage(data) {
  return request({
    url: '/app-api/wechat/service/sendMessage',
    method: 'post',
    data: data
  })
}

// 发送门禁卡模板消息
export function sendMenJinKaTemplate(params) {
  return request({
    url: '/app-api/template/menJinKa',
    method: 'get',
    params: params
  })
}

// 发送人脸模板消息
export function sendRenLianTemplate(params) {
  return request({
    url: '/app-api/template/renLian',
    method: 'get',
    params: params
  })
}

// 发送运维费模板消息
export function sendYunWeiFeiTemplate(params) {
  return request({
    url: '/app-api/template/yunWeiFei',
    method: 'get',
    params: params
  })
}

// 根据房东姓名查询房产资料
export function getHouseDetailByLandlord(params) {
  return request({
    url: '/door/adsl/list',
    method: 'get',
    params: params
  })
}

// 获取账单列表
export function getBillList(params) {
  return request({
    url: '/admin-api/door/detail/list',
    method: 'get',
    params
  })
}
